<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">

form {
	background-color: #fff;
	border: 1px solid #ccc;
	border-radius: 5px;
	box-shadow: 0px 0px 10px #ccc;	
	padding-left:20px;
	display: inline-block;
	height:390px;
	width:90%;
}

input[type="tel"], input[type="password"] {
padding: 10px;
border-radius: 5px;
border: 1px solid #ccc;
box-sizing: border-box;
margin-bottom: 15px;
}
input[type="submit"] {
background-color: #333;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
}
input[type="submit"]:hover {
background-color: #444;
}
input:invalid {
border-color: red;
}
input:valid {
border-color: #ccc;
}
.error {
color: red;
font-size: 14px;
margin-top: -10px;
margin-bottom: 10px;
}
.sec{
	height:30px;
	width:80px;
	border-radius: 10px;
}
.button_select{
	border:none;
	background-color:white;
	font-size:20px;
	margin-top:10px;
	margin-bottom:40px;
	outline:none;
	text-align:center;
	height:20px;
	width:100px;
}
.button{
	margin-bottom:10px;
}
</style>
</head>
<body >
	<!--<h1>南航用车管理系统</h1> --> 
		
	<form  action="C_Servlet" method="get" >
			<input type="hidden" name="action" value="addStaff_enroll">
			<button class="button_select" style="margin-right:50px;margin-left:20px;"onclick='location.href=("C-form_login.jsp")'>登录</button>
			<button  class="button_select" style="margin-right:20px" >职员注册</button>
		<br/>
			&nbsp;职员工号：<input type="tel"  name="EmpID"  required><br/>
			&nbsp;电话号码：<input type="tel"  name="phone" pattern="[0-9]{11}" required><br/>
			&nbsp;密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 码：<input type="password" id="password" name="password" required><br/>
			&nbsp;确认密码：<input type="password" id="confirm_password" name="confirm_password" required><br/>
		<%
			String loginok=(String)request.getAttribute("loginok");
			System.out.println(loginok);
			if(loginok!=null)
			{
				if(loginok.equals("1"))
				{
				
			%>	
				<span class="error">注册成功</span><br/>
			<%
				}else if(loginok.equals("0"))
				{
			%>
				<span class="error">工号不存在，注册失败</span><br/>
			<%
				}
				else
				{
			%>
					<span class="error">工号已经注册过</span><br/>
			<%		
				}
			}
		%>
		<br/><br/>		
		<div style="text-align:center;" >
			<input type="submit" class="button" value="注册">
		</div>
	</form>


	
<script language="javascript" type="text/javascript"> 
	var password = document.getElementById("password");
	var confirm_password = document.getElementById("confirm_password");

	function validatePassword(){
		if(password.value != confirm_password.value) {
			confirm_password.setCustomValidity("密码不一致，请重新输入");
		} else {
			confirm_password.setCustomValidity('');
		}
	}

	password.onchange = validatePassword;
	confirm_password.onkeyup = validatePassword;
	function myfunction()
	{
		
		if(document.getElementsByName("zw")[0].value=="管理员")
		{
			window.location.href='C-Admin.jsp';
		}
	}
	
</script>
</body>
</html>